#ifndef TRACE_MSR_HPP
#define TRACE_MSR_HPP

#include "trace/trace-driver.hpp"

/**
 * \file
 * \ingroup trace
 * cas::TraceMsr declaration.
 */

namespace cas
{
    /**
     * \ingroup trace
     */
    class TraceMsr : public TraceDriver
    {
    public:
        TraceMsr(std::string path = "");
        ~TraceMsr() override;

        size_t dataSize();

        /**
         * \brief MSR trace line structure
         */
        struct MsrData
        {
            uint64_t timestp;
            uint64_t lba;
            uint32_t size;
            uint16_t devno;
            bool rw; /**< true = write, false = read */

            MsrData(uint64_t _timestp = 0, uint64_t _lba = 0, uint32_t _size = 0, uint16_t _devno = 0, bool _rw = false)
                : timestp(_timestp), lba(_lba), size(_size), devno(_devno), rw(_rw){};
        };

        std::vector<MsrData> data; /**< trace data */

    private:
        bool parseLine(std::istringstream &sin) override;
    };
} // namespace cas

#endif /* TRACE_MSR_HPP */